<?php
session_start ();
$_SESSION ['pathway'] = '..';
include ("../header.php");

// ~ print_r($_POST);

if (! isset ( $_SESSION ['id'] ) or $_SESSION ['acces_genetique'] < 1) {
	echo "<table><tr><td>Session expired</td></tr>";
	echo "<tr><td><a href='" . $_SESSION ['pathway'] . "/index.php'>Start</a></td></tr></table>";
} else {
	
	if (isset ( $_GET ['save'] ) and $_GET ['save'] == 'yes') {
		include ("./requetes/remplissage_score_CCFS.php");
	}
	
	include ("./requetes/remplissage_questionnaire_CCFS.php");
	require_once ("./requetes/recupere_age.php");
	
	if ($hash_champ_CCFS ['hand'] == 'right') {
		$check_hand_right = 'checked';
	} elseif ($hash_champ_CCFS ['hand'] == 'left') {
		$check_hand_left = 'checked';
	}
	
	$_SESSION ['hash_CCFS'] = $hash_champ_CCFS;
	
	?><a
	href="./page_principale.php?form=<?php echo $_SESSION['form'];?>#annexes">Back to form <?php echo $_SESSION['form'];?></a>


<form name='frm_ccfs'
	action="ccfs.php?form=<?php echo $_SESSION['form']; ?>&amp;save=yes#annexes"
	method='post'>
	<?php
	$disabled_tous = '';
	if ($_SESSION ['acces_clinique'] >= 2) {
		if ($_SESSION ['modification_groupe'] == '0') {
			$disabled_tous = 'disabled';
		} else {
			if ($_SESSION ['id'] != $hash_champ_valeur ['user']) {
				$querygroupe_user = "SELECT `ID_people_groupe`
				FROM `users`
				WHERE `last_name` LIKE '" . $_SESSION ['id'] . "';";
				// ~ echo $querygroupe_user."<br />";
				$resultgroupe_user = mysql_query ( $querygroupe_user ) or die ( "Impossible de r&#233;cup&#233;rer la liste des groupes" . mysql_error () );
				while ( $line = mysql_fetch_array ( $resultgroupe_user ) ) {
					$groupe_user = $line ['ID_people_groupe'];
				}
				if ($_SESSION ['ID_people_groupe'] == $groupe_user && $_SESSION ['modification_groupe'] < 2) { // cas ou modif user dans le meme groupe mais n'a pas les droits
					$disabled_tous = 'disabled';
				} elseif ($_SESSION ['ID_people_groupe'] != $groupe_user and $_SESSION ['modification_groupe'] < 3) { // cas ou pas dans le meme groupe, masi tous les droits
					$disabled_tous = 'disabled';
				}
			}
		}
	} else {
		$disabled_tous = 'disabled';
	}
	// ~ echo "<br />"."ID_people_groupe : ".$_SESSION['ID_people_groupe']." modification_groupe : ".$_SESSION['modification_groupe']." groupe_user : ". $groupe_user."<br />";
	
	?>


	<table class='principale'>


		<tr style='display: table-row;';>
			<td><h2>ANNEX 3: Composite Cerebellar Functional Severity Score
					&#40;CCFS&#41;</h2></td>
		</tr>

		<tr>
			<td><br> <b>Dominant hand</b></td>
		</tr>
		<tr>
			<td><label><input <?php echo $disabled_tous;?> type='radio'
					name='hand' value='right' <?php echo $check_hand_right ?> />Right</label>
				<label><input <?php echo $disabled_tous;?> type='radio' name='hand'
					value='left' <?php echo $check_hand_left ?> />Left</label></td>
		</tr>

		<tr>
			<td><b>Nine-hole Pegboard test - dominant hand <br /> The patient is
					seated and holds nine dowels &#40;9mm in diameter and 32-mm
					long&#41; in one hand and places them randomly, one by one, with
					the other hand in a board with nine holes. Timing begins when the
					first peg is placed in a hole and ends when<br /> the last peg is
					placed. The examiner holds the board steady on the table during the
					test. The trial is performed once only with the dominant hand. If
					the patient drops a peg the examiner stops the timer and the
					patient starts the test again once <br />from the beginning.
			</b></td>
		</tr>
		<tr>
			<td>Timing dominant hand: <input <?php echo $disabled_tous;?>
				type="text" style="width: 40px;" name="pegboard_timing"
				value="<?php if(isset($hash_champ_CCFS['pegboard_timing'])){ echo $hash_champ_CCFS['pegboard_timing']; } ?>">sec
			</td>
		</tr>

		<tr>
			<td><br> <b>Click test - dominant hand<br />The patient is seated
					facing the examiner across a table on which is placed a device
					composed of two mechanical counters fixed on a wooden board 39 cm
					apart. The patient uses his index finger to press the buttons on
					the counters <br />alternately 10 times. Timing begins when the
					first button is pressed and stops when the second counter reaches
					10. The trial is performed once only with the dominant hand.
			</b></td>
		</tr>
		<tr>
			<td>Timing dominant hand: <input <?php echo $disabled_tous;?>
				type="text" style="width: 40px;" name="clicktest_timing"
				value="<?php if(isset($hash_champ_CCFS['clicktest_timing'])){ echo $hash_champ_CCFS['clicktest_timing']; } ?>">sec
			</td>
		</tr>

		<tr>
			<td><input <?php echo $disabled_tous;?> type='submit'
				value='Calculate'></td>
		</tr>
	</table>
</form>

<!------------ <form name='frm_ccfs2' action="./page_principale.php?form=<?php echo $_SESSION['form']; ?>&amp;from=ccfs#annexes" method='post'> -->
<table class='principale'>

	<tr>
		<td><br /> <br /> <br /></td>
	</tr>
	<tr>
		<td><b>Age (from recorded birthdate) : <?php echo $age; ?></b></td>
	</tr>
	<tr>
		<td>Z pegboard dominant hand = Pegboard DH &#150; &#40;13.4-0.16*age +
			0.002*age&#178;&#41; = <input <?php echo $disabled_tous;?>
			type="text" name="score_pegboard" size="5" readonly="readonly"
			value="<?php if(isset($hash_champ_CCFS['score_pegboard'])){ echo $hash_champ_CCFS['score_pegboard']; } ?>" />
		</td>
	</tr>
	<tr>
		<td>Z click dominant hand = click DH &#150; &#40;8 + 0.05*age&#41; = <input
			<?php echo $disabled_tous;?> type="text" name="score_clicktest"
			size="5" readonly="readonly"
			value="<?php if(isset($hash_champ_CCFS['score_clicktest'])){ echo $hash_champ_CCFS['score_clicktest']; } ?>" /></td>
	</tr>

	<tr>
		<td><b>CCFS = log10(7 &#134; Z pegboard dominant hand /10 &#134; 4*Z
				click dominant hand /10) = <input <?php echo $disabled_tous;?>
				type="text" name="score_CCFS" size="10" readonly="readonly"
				value="<?php if(isset($hash_champ_CCFS['score_CCFS'])){ echo $hash_champ_CCFS['score_CCFS']; } ?>" />
		</b></td>
	</tr>
	<tr>
		<td>(Mean normal values 0.85 &#177; 0.05 (0.64 &#150; 0.94))</td>
	</tr>

	<tr>
		<td><br /> <br /> <br /></td>
	</tr>
	<tr>
		<td><input <?php echo $disabled_tous;?> type='button' value='Save'
			OnClick="window.location.href='./page_principale.php?form=<?php echo $_SESSION['form']; ?>&amp;from=ccfs#annexes'" /></td>
	</tr>

</table>
<!------------</form>-->



<?php
}

include ("../footer.php");
?>
